import time
from greenlet import greenlet


def test1():
    for i in range(10):
        print("test1---", i)
        g2.switch()
        time.sleep(0.1)
        g1.switch()


def test2():
    for i in range(10):
        print("test1---", i)
        g1.switch()
        time.sleep(0.1)
        g2.switch()


g1 = greenlet(test1)
g2 = greenlet(test2)

g1.switch()
